package myCommunity.biz.impl;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Service;

import myCommunity.biz.CommunityUserBiz;
import myCommunity.entity.CommunityUser;

@Service
public class CommunityUserBizImpl implements CommunityUserBiz{
	private HibernateTemplate hibernateTemplate;
	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}
	@Override
	public void UpdateCommunityUser(CommunityUser c) {
		hibernateTemplate.update(c);
		
	}

	@Override
	public void AddCommunityUser(CommunityUser c) {
		hibernateTemplate.save(c);
		
	}

	@Override
	public CommunityUser checkLogin(String Username, String Password) {
		List<CommunityUser> list=(List<CommunityUser>) hibernateTemplate
				.find("from CommunityUser where username=? and password=?",Username,Password);
		return list.size()==0?null:list.get(0);
	}

}
